package org.example.crawler.controller;


import org.example.crawler.service.PythonService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class PythonController {

    private final PythonService pythonService;

    public PythonController(PythonService pythonService) {
        this.pythonService = pythonService;
    }

    @GetMapping("/execute")
    public String executeScript(
            @RequestParam String keyList,
            @RequestParam int sourceType) {
        return pythonService.executePythonScript(keyList, sourceType);
    }

    @GetMapping("/keywords")
    public Map<String, List<String>> getKeywords() {
        return pythonService.getAvailableKeywords();
    }
}